/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package Players;

import Engine.Engine;
import Ships.Ship;
import java.util.Random;
import javax.media.opengl.GLAutoDrawable;

/**
 * Jogador controlado pela IA do jogo.
 *
 * @author Gustavo Buzogany Eboli
 */
public class ComputerPlayer extends Player {

    private Ship target;

    public ComputerPlayer(Engine e, GLAutoDrawable drawable)
    {
        this.engine = e;
        Ship ship = new Ship(engine.getNextIdentifier(), engine, 2);
        target = engine.getHumanPlayer().getMyShip();
        this.setMyShip(ship);
        Random rand = new Random();
        float ang = rand.nextFloat()*rand.nextInt(360);
        ship.setPos(target.getPos().x()+(float)(100*Math.cos(ang)), target.getPos().y()+(float)(100*Math.sin(ang)), 0);
        ship.setTarget(target);
        ship.setDrawable(drawable);
        engine.insertMovable(ship);
    }
}
